import Vue from "vue";
import VueRouter from "vue-router";
// 引入登录组件
import Login from '@/views/login/index'
import Layout from '@/views/layout/index'
// 首页
import Home from '@/views/home/index'
// 问答
import Question from '@/views/question/index'
// 视频
import Video from '@/views/video/index'
// 我的
import User from '@/views/user/index'

Vue.use(VueRouter);
// 配置路由
const routes = [
  // 登陆页面
  {
    path: "/login",
    component: Login
  },
  {
    path: "/layout",
    component: Layout,
    children: [
      // 首页
      { path: '/home', component: Home },
      // 问答
      { path: '/question', component: Question },
      // 视频
      { path: '/video', component: Video },
      // 我的
      { path: '/user', component: User }
    ]
  }
]

const router = new VueRouter({
  routes
});

export default router;
